package my.crawler.impl.navigation;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import my.crawler.data.ObjectData;

/**
 * Navigation using navigation page
 * @author Root
 *
 */
public class Navigator  {
	public MultyObjectPage navigationPage;
	public String urlFieldName;
	public Page iteratorPage;
	
	public URL startURL;

	public List<URL> getPages() throws Exception {
		List<URL> pages = new ArrayList<URL>();
		for(ObjectData object : navigationPage.getObjects(startURL)) {
			String url = object.get(urlFieldName);
			pages.add(new URL(url));
		}
		return pages;
	}
}
